<!DOCTYPE HTML>
<html>
<head>
    {include file="Public/header"/}
    <title>配置管理</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    首页
    <span class="c-gray en">&gt;</span>
    系统设置
    <span class="c-gray en">&gt;</span>
    配置管理
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
             <a class="btn btn-primary radius" href="javascript:;" onclick="config_add('新增配置','{:url('configAdd')}','800')">
                 <i class="Hui-iconfont">&#xe600;</i>
                 新增配置
             </a>
		</span>
    </div>

    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg sorting_desc table-sort">
            <thead>
            <tr class="text-c">
                <th width="25"><input type="checkbox" value="" name=""></th>
                <th width="40">ID</th>
                <th>标识</th>
                <th width="200">标题</th>
                <th width="300">分组</th>
                <th width="70">操作</th>
            </tr>
            </thead>
            <tbody>

            </tbody>
        </table>
    </div>
</div>

{include file="Public/footer" /}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/Hui/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript">
    $('.table-sort').dataTable({
        "createdRow": function( row, data, dataIndex ) {
            $(row).addClass( 'text-c' );
        },
        stateSave:true,  //状态保存
        serverSide:true, //服务器模式
        processing:true, //打印信息字符信息
        paging    :true, // 开启本地分页
        searching :true, //开启搜索
        lengthMenu:[10,20,30,40,100,150,300], //左上角select选项
        ajax: {
            "url":"",
            "data":function(d){    //额外传递的参数
            }
        },
        aoColumns:[
            {
                "data": "id",
                "render": function (data, type, full, meta) {
                    return '<input type="checkbox"  name=""  value="' + data + '" />';
                },

                "orderable":false
            },
            {data : "id"},
            {data : "name"},
            {data : "title"},
            {data : "group"},
            {
                data : "id",
                "render" : function (data){
                    return '<a title="编辑" href="javascript:;" onclick="config_edit(\''+"编辑"+'\',\''+'configEdit.html?id='+data+'\','+data+')" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a><a title="删除" href="javascript:;" onclick="config_del(this,'+data+')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a> ';
                }
            }
        ]
    });

    function config_add(title,url,w,h){
        layer_show(title,url,w,h);
    }

    function config_edit(title,url,id,w,h){
        layer_show(title,url,w,h);
    }

    var configDel = "{:url('configDel')}";
    function config_del(obj,id){
        layer.confirm('配置删除须谨慎，确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: configDel,
                data:{id : id},
                dataType: 'json',
                success: function(data){
                    if(data.code){
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000},function () {
                            location.reload();
                        });
                    }else {
                        layer.msg(data.msg,{icon:5});
                    }
                },error:function(data) {
                    layer.msg(data.msg,{icon:5});
                }
            });
        });
    }
</script>
</body>
</html>